﻿<%@ Page Language="C#" MasterPageFile="~/Wap/Shop/ShopSite.Master"  AutoEventWireup="true" CodeBehind="VideoProductDetail.aspx.cs" Inherits="ZLCMS.Web.Wap.Shop.VideoProductDetail" %>

<%@ Import Namespace="ZLCMS.Business.Util" %>
<%@ Register src="~/Wap/Shop/Footer.ascx" tagname="Footer" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>--</title>
    <style type="text/css">
        .mot table{border:solid #ddd; border-width:1px 0px 0px 1px; font-size:12px;}
        .mot td{border:solid #ddd; border-width:0px 1px 1px 0px; padding: 3px;}
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="pages" runat="server">
<!--S page -->
<div data-role="page" id="mypage" class="VideoProductDetail">
    <!--S content -->
	<div role="main" class="ui-content loaderHandler" id="productList">
        <div class="videoPlaySection">
            <iframe src="" id="embed" frameborder="0" width="100%" height="350" allowfullscreen></iframe>
        </div>
        <div class="videoInfo">
            <p class="title" Prop="Detail.Title">加载中...</p>
            <p class="summary" Prop="Detail.Summary">-</p>
            <p class="uptime" Prop="Detail.CreateDate">-</p>
        </div>
        <div class="RelatedProducts">
           <p class="overflow"><span class="fl">相关产品</span><span class="fr more" ><a  data-ajax="false" id="morePro">更多</a></span></p>
            <ul class="overflow" id="RelatedProducts">
            </ul>
        </div>

 	</div>
    <!--E content -->
	
    <!--S footer -->
	<div data-role="footer" data-position="fixed" data-tap-toggle="false">
            <uc1:Footer ID="Footer1" runat="server" />
    </div>
    <!--E footer -->
</div>
<!--E page -->

<script src="/wap/lib/common/loaderHandler.js" type="text/javascript"></script>

<script type="text/javascript">
    $(function () {
        $(".RelatedProducts ul li a img").height($(".RelatedProducts ul li a img").width() / 1.5);
        //playStatusToggle();

        var handler = $('#productList').loaderHandler();
        handler.initialize({
            command: 'Pub.LoadVideoProductDetail',
            parameter: { pid: '<%=Request["pid"] %>' },
            beforeHandleResult: function (result, totalCount, container) {
                result.Detail.CreateDate = (result.Detail.CreateDate).substring(0, 10);
                document.title = result.Detail.Title;
            },
            afterHandleResult: function (result, totalCount, container) {
                $("#morePro").bind("click", function () {
                    location.href = result.Detail.Name;
                });

                $("#embed").attr("src", result.Detail.Url);
                if (result.Detail.RelatedProduct && (result.Detail.RelatedProduct.length > 0)) {
                    $.each(result.Detail.RelatedProduct, function (key, val) {

                        $("#RelatedProducts").append('<li>'
                      + '<a data-ajax="false" href="ProductDetail.aspx?no=' + $(this)[0]["ProductNo"] + '">'
                      + '   <img src="' + firstFilePath(this.ThumbnailImg) + '" />'
                      + '</a>'
                      + '<p class="clamp" prop="Detail.Title">' + this.ProductName + '</p>'
                      + '<div><span>￥' + this.SalePrice + '</span></div>'
                      + '</li>');
                    });
                }

                //设置分享
                shareTitle = result.Detail.Title;
                try {
                    var shaerLogoUrl = firstFilePath(result.Detail.ThumbnailUrl);
                    if (shaerLogoUrl.indexOf("http") == 0) {
                        shareLogo = shaerLogoUrl + '.thumb.jpg';
                    }
                    else {
                        shareLogo = '<%=ServerUtil.GetRootURI() %>' + shaerLogoUrl + '.thumb.jpg';
                    }
                } catch (e) { }
                shareDesc = result.Detail.Summary;

                if (window.wx) {
                    wx.onMenuShareTimeline({
                        title: shareTitle, // 分享标题
                        link: shareUrl, // 分享链接
                        imgUrl: shareLogo, // 分享图标
                        success: function () {
                            // 用户确认分享后执行的回调函数
                        },
                        cancel: function () {
                            // 用户取消分享后执行的回调函数
                        }
                    });
                    wx.onMenuShareAppMessage({
                        title: shareTitle, // 分享标题
                        desc: shareDesc, // 分享描述
                        link: shareUrl, // 分享链接
                        imgUrl: shareLogo, // 分享图标
                        success: function () {
                            // 用户确认分享后执行的回调函数
                        },
                        cancel: function () {
                            // 用户取消分享后执行的回调函数
                        }
                    });
                }
                //******end
            }

        });
        handler.load();

    });





  

</script>

</asp:Content>
